package dao

import (
	"context"
	"github.com/olivere/elastic/v7"
)

type AnyElasticDAO struct {
	client *elastic.Client
}

func NewAnyElasticDAO(client *elastic.Client) *AnyElasticDAO {
	return &AnyElasticDAO{client: client}
}

func (h *AnyElasticDAO) InputAny(ctx context.Context, index string, docId string, data string) error {
	_, err := h.client.Index().Index(index).Id(docId).BodyJson(data).Do(ctx)
	return err
}
func (h *AnyElasticDAO) Delete(ctx context.Context, index string, id string) error {
	_, err := h.client.Delete().Index(index).Id(id).Do(ctx)
	return err
}
